package com.market.service;

import com.market.dto.ShopCartDto;
import com.market.entity.*;
import com.market.exceptions.MyException;
import com.market.vo.R;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;

/**
 * @ClassName BuyerService
 * @Description 买家业务层
 * @Author pengqing
 * @Date 2022/3/24 13:16
 * @Version 1.0
 */
public interface BuyerService {
    //发送短信验证码
    boolean sendCode(String telephone, HttpServletRequest request) throws IOException;

    //买家通过短信验证注册
    boolean buyerRegisterByCode(Buyer buyer,String code) throws IOException;

    //买家通过账号密码注册
    boolean buyerRegisterByAccountAndPwd(Buyer buyer) throws MyException;

    //根据账号查看某个买家
    Buyer queryBuyerByAccount(String account);

    //买家通过账号密码登录
    boolean buyerLoginByAccountAndPwd(String account, String password) throws MyException;

    //买家通过短信验证登录
    boolean buyerLoginBySmsVerification(String SmsVerificationCode,String telephone);

    //添加买家所在地址
    boolean addBuyerAddress(int buyerId,String address);

    //修改基本买家信息(昵称，电话号码，地址，性别)
    boolean updateBuyerInfo(Integer buyerId,String nickname,String telephone,String address,String sex);

    //买家查看商品
    Goods queryGoods(int goodsId);

    // 买家下单(调用订单的方法)
    boolean createOrder(Order order);

    // 买家确认收货（调用订单的方法）
    boolean confirmReceipt(int orderId);

    //锁定买家
    boolean lockBuyer(int buyerId);

    //解锁买家
    boolean unLockBuyer(int buyerId);

    //根据买家id查询某个买家
    Buyer queryBuyerById(int buyerId);

    //查询所有买家
    List<Buyer> queryAllBuyer();


    //todo 买家通过支付宝线上付款
    boolean payByAlipay();

    //加入购物车
    boolean addToCart(int goodsId,int goodsNum,int buyerId);

    //申请退货
    boolean applyReturnGoods(int orderId);

    //申请换货
    boolean applyExchangeGoods(int orderId);

    //根据商品名查找某个商品
    Goods queryGoodsByGoodsName(String GoodsName);

    //根据商品类别id查找商品
    List<Goods> queryGoodsByGoodsTypeId(int goodsTypeId);

     //充值
    boolean charge(int buyerId,double money);

    //付款
    boolean pay(int orderId);

    //根据小店id查看买家
    List<Buyer> queryBuyerByStoreId(int storeId);

    //添加小店id
    boolean addStoreId(int buyerId,int storeId);

    //添加订单详情
    boolean addOrderDetail(OrderDetail orderDetail);

    //买家查看购物车
    List<ShopCartDto> queryShopCartByBuyerId(int buyerId);
}
